import request from "@/plugins/axios";

/**
 * 分页查询资产已入库记录
 * @param searchKeyword
 * @param currentPage
 * @param pageSize
 */
export function toBeInitiatedChangeList(params) {
    return request({
        url: "/api/asset/fixed/warehousing/toBeInitiatedChangeList",
        method: "get",
        params
    });
}

/**
 * 查询资产已入库
 * @param id
 */
export function seacrhWarehousing(id) {
    return request({
        url: "/api/asset/fixed/warehousing/already/" + id,
        method: "get"
    });
}

/**
 * 校验资产名称唯一性(修改时)
 * @param path
 */
export function checkAssetNameByUpdate(assetName, assetFixedWarehousingId) {
    return request({
        url:
            "/api/asset/fixed/warehousing/check-assetName-update?assetName=" +
            assetName +
            "&assetFixedWarehousingId=" +
            assetFixedWarehousingId,
        method: "get"
    });
}

/**
 * 校验资产编码唯一性(修改时)
 * @param path
 */
export function checkAssetCodeByUpdate(assetCode, assetFixedWarehousingId) {
    return request({
        url:
            "/api/asset/fixed/warehousing/check-assetCode-update?assetCode=" +
            assetCode +
            "&assetFixedWarehousingId=" +
            assetFixedWarehousingId,
        method: "get"
    });
}

/**
 * 校验凭证号唯一性(修改时)
 * @param path
 */
export function checkVoucherNoByUpdate(voucherNo, assetFixedWarehousingId) {
    return request({
        url:
            "/api/asset/fixed/warehousing/check-voucherNo-update?voucherNo=" +
            voucherNo +
            "&assetFixedWarehousingId=" +
            assetFixedWarehousingId,
        method: "get"
    });
}

/**
 * 导出
 * @param searchKeyword
 * @param currentPage
 * @param pageSize
 */
export function exportWarehousing(params) {
    return request({
        url: "/api/asset/fixed/warehousing/waiting/change/export",
        method: "get",
        responseType: "blob",
        params
    });
}

/**
 * 发起资产变更
 * @param editObj
 */
export function doInitiateChange(editObj) {
    return request({
        url: "/api/asset/fixed/warehousing/initiate-change",
        method: "put",
        data: editObj
    });
}
